﻿using LuShanTea.Service.Entities;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LuShanTea.Service.ModelConfig
{
    class UserConfig : EntityTypeConfiguration<User>
    {
        public UserConfig()
        {
            this.ToTable("T_Users");
            //Property(u => u.Id).HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
            Property(u => u.Name).HasMaxLength(32);
            Property(u => u.NiceName).IsRequired().HasMaxLength(32);
            Property(u => u.PhoneNumber).IsRequired().HasMaxLength(16).IsUnicode(false);
            Property(u => u.Email).IsRequired().HasMaxLength(64);
            Property(u => u.HashPwd).IsRequired().HasMaxLength(128).IsUnicode(false);
            Property(u => u.Salt).IsRequired().HasMaxLength(16).IsUnicode(false);
            Property(u => u.ImgSrc).HasMaxLength(128).IsUnicode(false).IsUnicode(false);
        }
    }
}
